<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Box2D: b2Collision.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="icon.gif"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Box2D
   &#160;<span id="projectnumber">2.2.1</span>
   </div>
   <div id="projectbrief">A 2D Physics Engine for Games</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">b2Collision.h</div>  </div>
</div>
<div class="contents">
<a href="b2_collision_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org</span>
<a name="l00003"></a>00003 <span class="comment">*</span>
<a name="l00004"></a>00004 <span class="comment">* This software is provided &#39;as-is&#39;, without any express or implied</span>
<a name="l00005"></a>00005 <span class="comment">* warranty.  In no event will the authors be held liable for any damages</span>
<a name="l00006"></a>00006 <span class="comment">* arising from the use of this software.</span>
<a name="l00007"></a>00007 <span class="comment">* Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00008"></a>00008 <span class="comment">* including commercial applications, and to alter it and redistribute it</span>
<a name="l00009"></a>00009 <span class="comment">* freely, subject to the following restrictions:</span>
<a name="l00010"></a>00010 <span class="comment">* 1. The origin of this software must not be misrepresented; you must not</span>
<a name="l00011"></a>00011 <span class="comment">* claim that you wrote the original software. If you use this software</span>
<a name="l00012"></a>00012 <span class="comment">* in a product, an acknowledgment in the product documentation would be</span>
<a name="l00013"></a>00013 <span class="comment">* appreciated but is not required.</span>
<a name="l00014"></a>00014 <span class="comment">* 2. Altered source versions must be plainly marked as such, and must not be</span>
<a name="l00015"></a>00015 <span class="comment">* misrepresented as being the original software.</span>
<a name="l00016"></a>00016 <span class="comment">* 3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00017"></a>00017 <span class="comment">*/</span>
<a name="l00018"></a>00018 
<a name="l00019"></a>00019 <span class="preprocessor">#ifndef B2_COLLISION_H</span>
<a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define B2_COLLISION_H</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;Box2D/Common/b2Math.h&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &lt;climits&gt;</span>
<a name="l00024"></a>00024 
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 <span class="keyword">class </span><a class="code" href="classb2_shape.html">b2Shape</a>;
<a name="l00030"></a>00030 <span class="keyword">class </span><a class="code" href="classb2_circle_shape.html" title="A circle shape.">b2CircleShape</a>;
<a name="l00031"></a>00031 <span class="keyword">class </span><a class="code" href="classb2_edge_shape.html">b2EdgeShape</a>;
<a name="l00032"></a>00032 <span class="keyword">class </span><a class="code" href="classb2_polygon_shape.html">b2PolygonShape</a>;
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="keyword">const</span> uint8 b2_nullFeature = UCHAR_MAX;
<a name="l00035"></a>00035 
<a name="l00038"></a><a class="code" href="structb2_contact_feature.html">00038</a> <span class="keyword">struct </span><a class="code" href="structb2_contact_feature.html">b2ContactFeature</a>
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040         <span class="keyword">enum</span> Type
<a name="l00041"></a>00041         {
<a name="l00042"></a>00042                 e_vertex = 0,
<a name="l00043"></a>00043                 e_face = 1
<a name="l00044"></a>00044         };
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="structb2_contact_feature.html#a833bc746e7cb5e3cd458f1c0809101d0">00046</a>         uint8 <a class="code" href="structb2_contact_feature.html#a833bc746e7cb5e3cd458f1c0809101d0" title="Feature index on shapeA.">indexA</a>;           
<a name="l00047"></a><a class="code" href="structb2_contact_feature.html#ad96712b6a0cc1f4b22b85b5948eab81d">00047</a>         uint8 <a class="code" href="structb2_contact_feature.html#ad96712b6a0cc1f4b22b85b5948eab81d" title="Feature index on shapeB.">indexB</a>;           
<a name="l00048"></a><a class="code" href="structb2_contact_feature.html#a3361b651f0a88fb60ec6aba9f4921cc2">00048</a>         uint8 <a class="code" href="structb2_contact_feature.html#a3361b651f0a88fb60ec6aba9f4921cc2" title="The feature type on shapeA.">typeA</a>;            
<a name="l00049"></a><a class="code" href="structb2_contact_feature.html#abb74afd6ee5b60834a3f8e2616182bdf">00049</a>         uint8 <a class="code" href="structb2_contact_feature.html#abb74afd6ee5b60834a3f8e2616182bdf" title="The feature type on shapeB.">typeB</a>;            
<a name="l00050"></a>00050 };
<a name="l00051"></a>00051 
<a name="l00053"></a><a class="code" href="unionb2_contact_i_d.html">00053</a> <span class="keyword">union </span><a class="code" href="unionb2_contact_i_d.html" title="Contact ids to facilitate warm starting.">b2ContactID</a>
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055         <a class="code" href="structb2_contact_feature.html">b2ContactFeature</a> cf;
<a name="l00056"></a><a class="code" href="unionb2_contact_i_d.html#a04c04f8fdcb799b33552d01b3aa3f245">00056</a>         uint32 <a class="code" href="unionb2_contact_i_d.html#a04c04f8fdcb799b33552d01b3aa3f245" title="Used to quickly compare contact ids.">key</a>;                                     
<a name="l00057"></a>00057 };
<a name="l00058"></a>00058 
<a name="l00069"></a><a class="code" href="structb2_manifold_point.html">00069</a> <span class="keyword">struct </span><a class="code" href="structb2_manifold_point.html">b2ManifoldPoint</a>
<a name="l00070"></a>00070 {
<a name="l00071"></a><a class="code" href="structb2_manifold_point.html#ab3616990e7d1644deeeb691246094bfa">00071</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_manifold_point.html#ab3616990e7d1644deeeb691246094bfa" title="usage depends on manifold type">localPoint</a>;              
<a name="l00072"></a><a class="code" href="structb2_manifold_point.html#af4218c2359cb7762cd4e9d8ecefab173">00072</a>         float32 <a class="code" href="structb2_manifold_point.html#af4218c2359cb7762cd4e9d8ecefab173" title="the non-penetration impulse">normalImpulse</a>;  
<a name="l00073"></a><a class="code" href="structb2_manifold_point.html#a0ac5375b1fc4675a0073129f56aa62c9">00073</a>         float32 <a class="code" href="structb2_manifold_point.html#a0ac5375b1fc4675a0073129f56aa62c9" title="the friction impulse">tangentImpulse</a>; 
<a name="l00074"></a><a class="code" href="structb2_manifold_point.html#afa7ec272b2b27abe129540f8fbe57fc5">00074</a>         <a class="code" href="unionb2_contact_i_d.html" title="Contact ids to facilitate warm starting.">b2ContactID</a> <a class="code" href="structb2_manifold_point.html#afa7ec272b2b27abe129540f8fbe57fc5" title="uniquely identifies a contact point between two shapes">id</a>;                 
<a name="l00075"></a>00075 };
<a name="l00076"></a>00076 
<a name="l00093"></a><a class="code" href="structb2_manifold.html">00093</a> <span class="keyword">struct </span><a class="code" href="structb2_manifold.html">b2Manifold</a>
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095         <span class="keyword">enum</span> Type
<a name="l00096"></a>00096         {
<a name="l00097"></a>00097                 e_circles,
<a name="l00098"></a>00098                 e_faceA,
<a name="l00099"></a>00099                 e_faceB
<a name="l00100"></a>00100         };
<a name="l00101"></a>00101 
<a name="l00102"></a><a class="code" href="structb2_manifold.html#ab8021128e9792cc7391a8804ea02173d">00102</a>         <a class="code" href="structb2_manifold_point.html">b2ManifoldPoint</a> <a class="code" href="structb2_manifold.html#ab8021128e9792cc7391a8804ea02173d" title="the points of contact">points</a>[<a class="code" href="b2_settings_8h.html#aa5f44cc9edf711433dea2b2ec94f3c42">b2_maxManifoldPoints</a>];   
<a name="l00103"></a><a class="code" href="structb2_manifold.html#a3604e9fef2a03347c5649c71a9fd4c79">00103</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_manifold.html#a3604e9fef2a03347c5649c71a9fd4c79" title="not use for Type::e_points">localNormal</a>;                                                             
<a name="l00104"></a><a class="code" href="structb2_manifold.html#a8825cea31b27dbbaf22c13c3070870d5">00104</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_manifold.html#a8825cea31b27dbbaf22c13c3070870d5" title="usage depends on manifold type">localPoint</a>;                                                              
<a name="l00105"></a>00105         Type type;
<a name="l00106"></a><a class="code" href="structb2_manifold.html#abf59ff6fa36bed34b0242ad54951a696">00106</a>         int32 <a class="code" href="structb2_manifold.html#abf59ff6fa36bed34b0242ad54951a696" title="the number of manifold points">pointCount</a>;                                                               
<a name="l00107"></a>00107 };
<a name="l00108"></a>00108 
<a name="l00110"></a><a class="code" href="structb2_world_manifold.html">00110</a> <span class="keyword">struct </span><a class="code" href="structb2_world_manifold.html" title="This is used to compute the current state of a contact manifold.">b2WorldManifold</a>
<a name="l00111"></a>00111 {
<a name="l00116"></a>00116         <span class="keywordtype">void</span> <a class="code" href="structb2_world_manifold.html#a896dd7e7d4d6f6a5bc69e19fbd6871bd">Initialize</a>(<span class="keyword">const</span> <a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold,
<a name="l00117"></a>00117                                         <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA, float32 radiusA,
<a name="l00118"></a>00118                                         <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB, float32 radiusB);
<a name="l00119"></a>00119 
<a name="l00120"></a><a class="code" href="structb2_world_manifold.html#acf8de61b73d9784d16f7d0e824ce44bf">00120</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_world_manifold.html#acf8de61b73d9784d16f7d0e824ce44bf" title="world vector pointing from A to B">normal</a>;                                                  
<a name="l00121"></a><a class="code" href="structb2_world_manifold.html#af15e84b90f102c0ac433be2d63604021">00121</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_world_manifold.html#af15e84b90f102c0ac433be2d63604021" title="world contact point (point of intersection)">points</a>[<a class="code" href="b2_settings_8h.html#aa5f44cc9edf711433dea2b2ec94f3c42">b2_maxManifoldPoints</a>];    
<a name="l00122"></a>00122 };
<a name="l00123"></a>00123 
<a name="l00125"></a><a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663d">00125</a> <span class="keyword">enum</span> <a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663d" title="This is used for determining the state of contact points.">b2PointState</a>
<a name="l00126"></a>00126 {
<a name="l00127"></a><a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663da7ce77ce1a592f49d92939997976c217b">00127</a>         <a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663da7ce77ce1a592f49d92939997976c217b" title="point does not exist">b2_nullState</a>,           
<a name="l00128"></a><a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663dac60dc479bee2089a695b37948179b3d4">00128</a>         <a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663dac60dc479bee2089a695b37948179b3d4" title="point was added in the update">b2_addState</a>,            
<a name="l00129"></a><a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663dafb032f2175741fa95361e55d1c069e0a">00129</a>         <a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663dafb032f2175741fa95361e55d1c069e0a" title="point persisted across the update">b2_persistState</a>,        
<a name="l00130"></a><a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663da42ca6d7de57b948c8c895cd6f51ee8be">00130</a>         <a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663da42ca6d7de57b948c8c895cd6f51ee8be" title="point was removed in the update">b2_removeState</a>          
<a name="l00131"></a>00131 };
<a name="l00132"></a>00132 
<a name="l00135"></a>00135 <span class="keywordtype">void</span> b2GetPointStates(<a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663d" title="This is used for determining the state of contact points.">b2PointState</a> state1[<a class="code" href="b2_settings_8h.html#aa5f44cc9edf711433dea2b2ec94f3c42">b2_maxManifoldPoints</a>], <a class="code" href="b2_collision_8h.html#a0a894e3715ce8c61b7958dd6e083663d" title="This is used for determining the state of contact points.">b2PointState</a> state2[b2_maxManifoldPoints],
<a name="l00136"></a>00136                                           <span class="keyword">const</span> <a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold1, <span class="keyword">const</span> <a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold2);
<a name="l00137"></a>00137 
<a name="l00139"></a><a class="code" href="structb2_clip_vertex.html">00139</a> <span class="keyword">struct </span><a class="code" href="structb2_clip_vertex.html" title="Used for computing contact manifolds.">b2ClipVertex</a>
<a name="l00140"></a>00140 {
<a name="l00141"></a>00141         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> v;
<a name="l00142"></a>00142         <a class="code" href="unionb2_contact_i_d.html" title="Contact ids to facilitate warm starting.">b2ContactID</a> id;
<a name="l00143"></a>00143 };
<a name="l00144"></a>00144 
<a name="l00146"></a><a class="code" href="structb2_ray_cast_input.html">00146</a> <span class="keyword">struct </span><a class="code" href="structb2_ray_cast_input.html" title="Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).">b2RayCastInput</a>
<a name="l00147"></a>00147 {
<a name="l00148"></a>00148         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> p1, p2;
<a name="l00149"></a>00149         float32 maxFraction;
<a name="l00150"></a>00150 };
<a name="l00151"></a>00151 
<a name="l00154"></a><a class="code" href="structb2_ray_cast_output.html">00154</a> <span class="keyword">struct </span><a class="code" href="structb2_ray_cast_output.html">b2RayCastOutput</a>
<a name="l00155"></a>00155 {
<a name="l00156"></a>00156         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> normal;
<a name="l00157"></a>00157         float32 fraction;
<a name="l00158"></a>00158 };
<a name="l00159"></a>00159 
<a name="l00161"></a><a class="code" href="structb2_a_a_b_b.html">00161</a> <span class="keyword">struct </span><a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>
<a name="l00162"></a>00162 {
<a name="l00164"></a>00164         <span class="keywordtype">bool</span> <a class="code" href="structb2_a_a_b_b.html#a8d170a2de7a267c3e19f5365685b713d" title="Verify that the bounds are sorted.">IsValid</a>() <span class="keyword">const</span>;
<a name="l00165"></a>00165 
<a name="l00167"></a><a class="code" href="structb2_a_a_b_b.html#aa26703e234bd6fb30fd443cd5001795a">00167</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_a_a_b_b.html#aa26703e234bd6fb30fd443cd5001795a" title="Get the center of the AABB.">GetCenter</a>()<span class="keyword"> const</span>
<a name="l00168"></a>00168 <span class="keyword">        </span>{
<a name="l00169"></a>00169                 <span class="keywordflow">return</span> 0.5f * (<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a> + <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>);
<a name="l00170"></a>00170         }
<a name="l00171"></a>00171 
<a name="l00173"></a><a class="code" href="structb2_a_a_b_b.html#aff8b9aa64069a33fe45025299aa0e9b7">00173</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_a_a_b_b.html#aff8b9aa64069a33fe45025299aa0e9b7" title="Get the extents of the AABB (half-widths).">GetExtents</a>()<span class="keyword"> const</span>
<a name="l00174"></a>00174 <span class="keyword">        </span>{
<a name="l00175"></a>00175                 <span class="keywordflow">return</span> 0.5f * (<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a> - <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>);
<a name="l00176"></a>00176         }
<a name="l00177"></a>00177 
<a name="l00179"></a><a class="code" href="structb2_a_a_b_b.html#ace4448c60ef309726e59247a8ae67db5">00179</a>         float32 <a class="code" href="structb2_a_a_b_b.html#ace4448c60ef309726e59247a8ae67db5" title="Get the perimeter length.">GetPerimeter</a>()<span class="keyword"> const</span>
<a name="l00180"></a>00180 <span class="keyword">        </span>{
<a name="l00181"></a>00181                 float32 wx = <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.x - <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>.x;
<a name="l00182"></a>00182                 float32 wy = <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.y - <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>.y;
<a name="l00183"></a>00183                 <span class="keywordflow">return</span> 2.0f * (wx + wy);
<a name="l00184"></a>00184         }
<a name="l00185"></a>00185 
<a name="l00187"></a><a class="code" href="structb2_a_a_b_b.html#ad551edba62d2ad6094672a9ba3e26496">00187</a>         <span class="keywordtype">void</span> <a class="code" href="structb2_a_a_b_b.html#ad551edba62d2ad6094672a9ba3e26496" title="Combine an AABB into this one.">Combine</a>(<span class="keyword">const</span> <a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>&amp; aabb)
<a name="l00188"></a>00188         {
<a name="l00189"></a>00189                 <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a> = b2Min(<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>, aabb.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>);
<a name="l00190"></a>00190                 <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a> = b2Max(<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>, aabb.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>);
<a name="l00191"></a>00191         }
<a name="l00192"></a>00192 
<a name="l00194"></a><a class="code" href="structb2_a_a_b_b.html#a34b9c7d824df845c10caa9c12ae90452">00194</a>         <span class="keywordtype">void</span> <a class="code" href="structb2_a_a_b_b.html#ad551edba62d2ad6094672a9ba3e26496" title="Combine an AABB into this one.">Combine</a>(<span class="keyword">const</span> <a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>&amp; aabb1, <span class="keyword">const</span> <a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>&amp; aabb2)
<a name="l00195"></a>00195         {
<a name="l00196"></a>00196                 <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a> = b2Min(aabb1.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>, aabb2.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>);
<a name="l00197"></a>00197                 <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a> = b2Max(aabb1.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>, aabb2.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>);
<a name="l00198"></a>00198         }
<a name="l00199"></a>00199 
<a name="l00201"></a><a class="code" href="structb2_a_a_b_b.html#aba5fc112e3c8d05e034a21d95fc37704">00201</a>         <span class="keywordtype">bool</span> <a class="code" href="structb2_a_a_b_b.html#aba5fc112e3c8d05e034a21d95fc37704" title="Does this aabb contain the provided AABB.">Contains</a>(<span class="keyword">const</span> <a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>&amp; aabb)<span class="keyword"> const</span>
<a name="l00202"></a>00202 <span class="keyword">        </span>{
<a name="l00203"></a>00203                 <span class="keywordtype">bool</span> result = <span class="keyword">true</span>;
<a name="l00204"></a>00204                 result = result &amp;&amp; <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>.x &lt;= aabb.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>.x;
<a name="l00205"></a>00205                 result = result &amp;&amp; <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>.y &lt;= aabb.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>.y;
<a name="l00206"></a>00206                 result = result &amp;&amp; aabb.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.x &lt;= <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.x;
<a name="l00207"></a>00207                 result = result &amp;&amp; aabb.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.y &lt;= <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.y;
<a name="l00208"></a>00208                 <span class="keywordflow">return</span> result;
<a name="l00209"></a>00209         }
<a name="l00210"></a>00210 
<a name="l00211"></a>00211         <span class="keywordtype">bool</span> RayCast(<a class="code" href="structb2_ray_cast_output.html">b2RayCastOutput</a>* output, <span class="keyword">const</span> <a class="code" href="structb2_ray_cast_input.html" title="Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).">b2RayCastInput</a>&amp; input) <span class="keyword">const</span>;
<a name="l00212"></a>00212 
<a name="l00213"></a><a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5">00213</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>;      
<a name="l00214"></a><a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f">00214</a>         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>;      
<a name="l00215"></a>00215 };
<a name="l00216"></a>00216 
<a name="l00218"></a>00218 <span class="keywordtype">void</span> b2CollideCircles(<a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold,
<a name="l00219"></a>00219                                           <span class="keyword">const</span> <a class="code" href="classb2_circle_shape.html" title="A circle shape.">b2CircleShape</a>* circleA, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA,
<a name="l00220"></a>00220                                           <span class="keyword">const</span> <a class="code" href="classb2_circle_shape.html" title="A circle shape.">b2CircleShape</a>* circleB, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB);
<a name="l00221"></a>00221 
<a name="l00223"></a>00223 <span class="keywordtype">void</span> b2CollidePolygonAndCircle(<a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold,
<a name="l00224"></a>00224                                                            <span class="keyword">const</span> <a class="code" href="classb2_polygon_shape.html">b2PolygonShape</a>* polygonA, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA,
<a name="l00225"></a>00225                                                            <span class="keyword">const</span> <a class="code" href="classb2_circle_shape.html" title="A circle shape.">b2CircleShape</a>* circleB, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB);
<a name="l00226"></a>00226 
<a name="l00228"></a>00228 <span class="keywordtype">void</span> b2CollidePolygons(<a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold,
<a name="l00229"></a>00229                                            <span class="keyword">const</span> <a class="code" href="classb2_polygon_shape.html">b2PolygonShape</a>* polygonA, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA,
<a name="l00230"></a>00230                                            <span class="keyword">const</span> <a class="code" href="classb2_polygon_shape.html">b2PolygonShape</a>* polygonB, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB);
<a name="l00231"></a>00231 
<a name="l00233"></a>00233 <span class="keywordtype">void</span> b2CollideEdgeAndCircle(<a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold,
<a name="l00234"></a>00234                                                            <span class="keyword">const</span> <a class="code" href="classb2_edge_shape.html">b2EdgeShape</a>* polygonA, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA,
<a name="l00235"></a>00235                                                            <span class="keyword">const</span> <a class="code" href="classb2_circle_shape.html" title="A circle shape.">b2CircleShape</a>* circleB, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB);
<a name="l00236"></a>00236 
<a name="l00238"></a>00238 <span class="keywordtype">void</span> b2CollideEdgeAndPolygon(<a class="code" href="structb2_manifold.html">b2Manifold</a>* manifold,
<a name="l00239"></a>00239                                                            <span class="keyword">const</span> <a class="code" href="classb2_edge_shape.html">b2EdgeShape</a>* edgeA, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA,
<a name="l00240"></a>00240                                                            <span class="keyword">const</span> <a class="code" href="classb2_polygon_shape.html">b2PolygonShape</a>* circleB, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB);
<a name="l00241"></a>00241 
<a name="l00243"></a>00243 int32 b2ClipSegmentToLine(<a class="code" href="structb2_clip_vertex.html" title="Used for computing contact manifolds.">b2ClipVertex</a> vOut[2], <span class="keyword">const</span> <a class="code" href="structb2_clip_vertex.html" title="Used for computing contact manifolds.">b2ClipVertex</a> vIn[2],
<a name="l00244"></a>00244                                                         <span class="keyword">const</span> <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a>&amp; normal, float32 offset, int32 vertexIndexA);
<a name="l00245"></a>00245 
<a name="l00247"></a>00247 <span class="keywordtype">bool</span> b2TestOverlap(     <span class="keyword">const</span> <a class="code" href="classb2_shape.html">b2Shape</a>* shapeA, int32 indexA,
<a name="l00248"></a>00248                                         <span class="keyword">const</span> <a class="code" href="classb2_shape.html">b2Shape</a>* shapeB, int32 indexB,
<a name="l00249"></a>00249                                         <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfA, <span class="keyword">const</span> <a class="code" href="structb2_transform.html">b2Transform</a>&amp; xfB);
<a name="l00250"></a>00250 
<a name="l00251"></a>00251 <span class="comment">// ---------------- Inline Functions ------------------------------------------</span>
<a name="l00252"></a>00252 
<a name="l00253"></a><a class="code" href="structb2_a_a_b_b.html#a8d170a2de7a267c3e19f5365685b713d">00253</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="structb2_a_a_b_b.html#a8d170a2de7a267c3e19f5365685b713d" title="Verify that the bounds are sorted.">b2AABB::IsValid</a>()<span class="keyword"> const</span>
<a name="l00254"></a>00254 <span class="keyword"></span>{
<a name="l00255"></a>00255         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> d = <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a> - <a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a>;
<a name="l00256"></a>00256         <span class="keywordtype">bool</span> valid = d.x &gt;= 0.0f &amp;&amp; d.y &gt;= 0.0f;
<a name="l00257"></a>00257         valid = valid &amp;&amp; lowerBound.IsValid() &amp;&amp; <a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>.<a class="code" href="structb2_vec2.html#aafb971cf7cc726f91fc3a8215fb0aa17" title="Does this vector contain finite coordinates?">IsValid</a>();
<a name="l00258"></a>00258         <span class="keywordflow">return</span> valid;
<a name="l00259"></a>00259 }
<a name="l00260"></a>00260 
<a name="l00261"></a>00261 <span class="keyword">inline</span> <span class="keywordtype">bool</span> b2TestOverlap(<span class="keyword">const</span> <a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>&amp; a, <span class="keyword">const</span> <a class="code" href="structb2_a_a_b_b.html" title="An axis aligned bounding box.">b2AABB</a>&amp; b)
<a name="l00262"></a>00262 {
<a name="l00263"></a>00263         <a class="code" href="structb2_vec2.html" title="A 2D column vector.">b2Vec2</a> d1, d2;
<a name="l00264"></a>00264         d1 = b.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a> - a.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>;
<a name="l00265"></a>00265         d2 = a.<a class="code" href="structb2_a_a_b_b.html#ab94b68fbad8348b22b0522469b11bdb5" title="the lower vertex">lowerBound</a> - b.<a class="code" href="structb2_a_a_b_b.html#ad4a8ec483ba13a2c02918b01d058a18f" title="the upper vertex">upperBound</a>;
<a name="l00266"></a>00266 
<a name="l00267"></a>00267         <span class="keywordflow">if</span> (d1.x &gt; 0.0f || d1.y &gt; 0.0f)
<a name="l00268"></a>00268                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00269"></a>00269 
<a name="l00270"></a>00270         <span class="keywordflow">if</span> (d2.x &gt; 0.0f || d2.y &gt; 0.0f)
<a name="l00271"></a>00271                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00272"></a>00272 
<a name="l00273"></a>00273         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00274"></a>00274 }
<a name="l00275"></a>00275 
<a name="l00276"></a>00276 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Sat Sep 17 2011 17:35:55 for Box2D by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
